/*
 *    Copyright (c) 2018-2025, lengleng All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 * Neither the name of the pig4cloud.com developer nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission.
 * Author: lengleng (wangiegie@gmail.com)
 */
import { getDetails } from '@/api/admin/user'

var validateUsername = (rule, value, callback) => {
  getDetails(value).then(response => {
    if (window.boxType === 'edit') callback()
    let result = response.data.data
    if (result !== null) {
      callback(new Error('用户名已经存在'))
    } else {
      callback()
    }
  })
}
export const tableOption = {
  border: true,
  index: true,
  indexLabel: '序号',
  stripe: true,
  menuAlign: 'center',
  editBtn: false,
  delBtn: false,
  align: 'center',
  addBtn: false,
  viewBtn:true,
  column: [
    {
    fixed: true,
    label: 'id',
    prop: 'userId',
    span: 24,
    hide: true,
    editDisabled: true,
    addVisdiplay: false
  }, {
    label: '资源名称',
    prop: 'resourceName',
    overHidden: true,
    addVisdiplay: false,
    editVisdiplay: false,
    span: 24,
  },
    {
      label: '指标',
      prop: 'indicatorName',
      overHidden: true,
      addVisdiplay: false,
      editVisdiplay: false,
      span: 24,
    },
    {
      label: '时间',
      prop: 'time',
      overHidden: true,
      addVisdiplay: false,
      editVisdiplay: false,
      span: 24,
    },
    {
      label: '指标值',
      prop: 'value',
      overHidden: true,
      addVisdiplay: false,
      editVisdiplay: false,
      span: 24,
    },
    {
      label: '单位',
      prop: 'measurement',
      overHidden: true,
      addVisdiplay: false,
      editVisdiplay: false,
      span: 24,
    },
    {
      label: '资源类型',
      prop: 'resourceTypeId',
      overHidden: true,
      addVisdiplay: false,
      editVisdiplay: false,
      span: 24,
    }
  ]
}
